# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'comment'
        db.create_table('poster_comment', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('n_number', self.gf('django.db.models.fields.IntegerField')()),
            ('reply_to', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['poster.blog'], unique=True)),
            ('commentator', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['poster.commentator'], unique=True)),
        ))
        db.send_create_signal('poster', ['comment'])

        # Adding model 'commentator'
        db.create_table('poster_commentator', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=30)),
            ('email', self.gf('django.db.models.fields.EmailField')(max_length=75)),
        ))
        db.send_create_signal('poster', ['commentator'])

        # Adding field 'blog.mod_time'
        db.add_column('poster_blog', 'mod_time',
                      self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2015, 1, 24, 0, 0), blank=True),
                      keep_default=False)

        # Adding field 'blog.thumbnail_image'
        db.add_column('poster_blog', 'thumbnail_image',
                      self.gf('django.db.models.fields.URLField')(default='', max_length=200, blank=True),
                      keep_default=False)

        # Adding field 'blog.n_views'
        db.add_column('poster_blog', 'n_views',
                      self.gf('django.db.models.fields.IntegerField')(default=0),
                      keep_default=False)

        # Adding field 'blog.n_comments'
        db.add_column('poster_blog', 'n_comments',
                      self.gf('django.db.models.fields.IntegerField')(default=0),
                      keep_default=False)


    def backwards(self, orm):
        # Deleting model 'comment'
        db.delete_table('poster_comment')

        # Deleting model 'commentator'
        db.delete_table('poster_commentator')

        # Deleting field 'blog.mod_time'
        db.delete_column('poster_blog', 'mod_time')

        # Deleting field 'blog.thumbnail_image'
        db.delete_column('poster_blog', 'thumbnail_image')

        # Deleting field 'blog.n_views'
        db.delete_column('poster_blog', 'n_views')

        # Deleting field 'blog.n_comments'
        db.delete_column('poster_blog', 'n_comments')


    models = {
        'poster.blog': {
            'Meta': {'object_name': 'blog'},
            'author': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
            'content': ('django.db.models.fields.TextField', [], {}),
            'create_time': ('django.db.models.fields.DateTimeField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'mod_time': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            'n_comments': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'n_views': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
            'tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['poster.tag']", 'symmetrical': 'False'}),
            'thumbnail_image': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
            'title': ('django.db.models.fields.CharField', [], {'max_length': '100'})
        },
        'poster.comment': {
            'Meta': {'object_name': 'comment'},
            'commentator': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['poster.commentator']", 'unique': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'n_number': ('django.db.models.fields.IntegerField', [], {}),
            'reply_to': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['poster.blog']", 'unique': 'True'})
        },
        'poster.commentator': {
            'Meta': {'object_name': 'commentator'},
            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
        },
        'poster.tag': {
            'Meta': {'object_name': 'tag'},
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '30'})
        }
    }

    complete_apps = ['poster']